import request from 'src/utils/request' // 添加拦截器

/**
 * 前端接口
 * @param {*} url：
 */
// 获取机器实时参数的信息
export function getReamtimeList(query) {
    return request({
        url: '/analysis-mang/equip/status/realtime/',
        method: 'get',
        params: query
    })
}

// 获取机台上次零件加工的信息
export function getEquipLast(query) {
    return request({
        url: '/analysis-mang/equip/process-sequence/last/',
        method: 'get',
        params: query
    })
}

// 获取机器历史参数的信息(效率波动)
export function getxlbdChart(query) {
    return request({
        url: '/analysis-mang/equip/status/history/',
        method: 'get',
        params: query
    })
}

// 获取机台当班时间的信息
export function getdbTime(query) {
    return request({
        url: '/analysis-mang/working-calendar/shift/',
        method: 'get',
        params: query
    })
}

// 获取机台机器状态的信息
export function getChartData(query) {
    return request({
        url: '/analysis-mang/equip/working-condition/',
        method: 'get',
        params: query
    })
}

// 获取机台工作日历的信息
export function getrlChartData(query) {
    return request({
        url: '/analysis-mang/working-calendar/equip/',
        method: 'get',
        params: query
    })
}

// 获取机台停机事件的信息
export function getStopTable(query) {
    return request({
        url: '/analysis-mang/equip/working-condition/event/',
        method: 'get',
        params: query
    })
}

// 获取机台机器状态列表的信息
export function getstatusChart(query) {
    return request({
        url: '/analysis-mang/equip/working-condition/list/',
        method: 'get',
        params: query
    })
}

// 标注停机原因的信息
export function getRess(id, data) {
    return request({
        url: `/analysis-mang/equip/working-condition/labels/${id}/`,
        method: 'patch',
        data
    })
}


// 增加一条机器装置与传感器设备关联的列表信息
export function adddevice(data) {
    return request({
        url: '/organizer/equipments/device/',
        method: 'post',
        data
    })
}

// 修改一条机器装置与传感器设备关联的列表信息
export function redactdevice(id, data) {
    return request({
        url: `/organizer/equipments/device/${id}/`,
        method: 'patch',
        data
    })
}

// 删除一条机器装置与传感器设备关联的列表信息
export function deletedevice(id) {
    return request({
        url: `/organizer/equipments/device/${id}/`,
        method: 'delete'
    })
}

// 查询机器装置与传感器设备关联的列表信息
export function getdeviceTableList(query) {
    return request({
        url: '/organizer/equipments/device/list/',
        method: 'get',
        params: query
    })
}

// 增加一条机器装置生产配置的信息
export function addproduct(data) {
    return request({
        url: '/organizer/equipments/product/',
        method: 'post',
        data
    })
}

// 修改一条机器装置生产配置的信息
export function redactproduct(id, data) {
    return request({
        url: `/organizer/equipments/product/${id}/`,
        method: 'patch',
        data
    })
}

// 删除一条机器装置生产配置的信息
export function deleteproduct(id) {
    return request({
        url: `/organizer/equipments/product/${id}/`,
        method: 'delete'
    })
}

// 查询机器装置生产配置的信息
export function getproductTableList(query) {
    return request({
        url: '/organizer/equipments/product/list/',
        method: 'get',
        params: query
    })
}

// 查询机器装置生产配置的信息
export function getGSQX(query) {
    return request({
        url: '/bms-mang/company/staffs/switch/',
        method: 'get',
        params: query
    })
}

// 获取某个机器日志列表
export function getLogsEquip(query) {
    return request({
        url: '/bms/logs/equip/',
        method: 'get',
        params: query
    })
}

// 获取车间消息列表
export function getShopfloor(query) {
    return request({
        url: '/bms/logs/shopfloor/',
        method: 'get',
        params: query
    })
}

//  获取消息和警报个数
export function getCounts(query) {
    return request({
        url: '/bms/message/counts/',
        method: 'get',
        params: query
    })
}

// 批量导入机器装置生产配置的信息
export function importProduct(data) {
    return request({
        url: '/organizer/equipments/product/batch/',
        method: 'post',
        data
    })
}

//  批量导出机器装置生产配置的信息
export function exportProduct(query) {
    return request({
        url: '/organizer/equipments/product/batch/',
        method: 'get',
        params: query
    })
}

//  查询停机台异常事件的列表信息
export function getExceptionList(query) {
    return request({
        url: '/analysis-mang/equip/exception/list/',
        method: 'get',
        params: query
    })
}

// 增加一条机台异常事件的信息
export function addException(data) {
    return request({
        url: '/analysis-mang/equip/exception/',
        method: 'post',
        data
    })
}

// 删除一条机台异常事件的信息
export function deletException(id) {
    return request({
        url: `/analysis-mang/equip/exception/${id}/`,
        method: 'delete'
    })
}